<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Application launching: GDK 3 Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
<link rel="home" href="index.html" title="GDK 3 Reference Manual">
<link rel="up" href="reference.html" title="API Reference">
<link rel="prev" href="gdk3-Wayland-Interaction.html" title="Wayland Interaction">
<link rel="next" href="gdk3-Testing.html" title="Testing">
<meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#gdk3-Application-launching.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
                  <a href="#gdk3-Application-launching.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_properties">  <span class="dim">|</span> 
                  <a href="#gdk3-Application-launching.properties" class="shortcut">Properties</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="reference.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="gdk3-Wayland-Interaction.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="gdk3-Testing.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="gdk3-Application-launching"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gdk3-Application-launching.top_of_page"></a>Application launching</span></h2>
<p>Application launching — Startup notification for applications</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="gdk3-Application-launching.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_proto_type">
<col class="functions_proto_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="gdk3-Application-launching.html#GdkAppLaunchContext"><span class="returnvalue">GdkAppLaunchContext</span></a> *
</td>
<td class="function_name">
<a class="link" href="gdk3-Application-launching.html#gdk-app-launch-context-new" title="gdk_app_launch_context_new ()">gdk_app_launch_context_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="gdk3-Application-launching.html#gdk-app-launch-context-set-display" title="gdk_app_launch_context_set_display ()">gdk_app_launch_context_set_display</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="gdk3-Application-launching.html#gdk-app-launch-context-set-screen" title="gdk_app_launch_context_set_screen ()">gdk_app_launch_context_set_screen</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="gdk3-Application-launching.html#gdk-app-launch-context-set-desktop" title="gdk_app_launch_context_set_desktop ()">gdk_app_launch_context_set_desktop</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="gdk3-Application-launching.html#gdk-app-launch-context-set-timestamp" title="gdk_app_launch_context_set_timestamp ()">gdk_app_launch_context_set_timestamp</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="gdk3-Application-launching.html#gdk-app-launch-context-set-icon" title="gdk_app_launch_context_set_icon ()">gdk_app_launch_context_set_icon</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="gdk3-Application-launching.html#gdk-app-launch-context-set-icon-name" title="gdk_app_launch_context_set_icon_name ()">gdk_app_launch_context_set_icon_name</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="gdk3-Application-launching.properties"></a><h2>Properties</h2>
<div class="informaltable"><table class="informaltable" border="0">
<colgroup>
<col width="150px" class="properties_type">
<col width="300px" class="properties_name">
<col width="200px" class="properties_flags">
</colgroup>
<tbody><tr>
<td class="property_type">
<a class="link" href="GdkDisplay.html" title="GdkDisplay"><span class="type">GdkDisplay</span></a> *</td>
<td class="property_name"><a class="link" href="gdk3-Application-launching.html#GdkAppLaunchContext--display" title="The “display” property">display</a></td>
<td class="property_flags">Read / Write / Construct Only</td>
</tr></tbody>
</table></div>
</div>
<a name="GdkAppLaunchContext"></a><div class="refsect1">
<a name="gdk3-Application-launching.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="other_proto_type">
<col class="other_proto_name">
</colgroup>
<tbody><tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="gdk3-Application-launching.html#GdkAppLaunchContext-struct" title="GdkAppLaunchContext">GdkAppLaunchContext</a></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="gdk3-Application-launching.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen">    GObject
    <span class="lineart">╰──</span> GAppLaunchContext
        <span class="lineart">╰──</span> GdkAppLaunchContext
</pre>
</div>
<div class="refsect1">
<a name="gdk3-Application-launching.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;gdk/gdkwayland.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="gdk3-Application-launching.description"></a><h2>Description</h2>
<p>GdkAppLaunchContext is an implementation of <span class="type">GAppLaunchContext</span> that
handles launching an application in a graphical context. It provides
startup notification and allows to launch applications on a specific
screen or workspace.</p>
<div class="refsect3">
<a name="id-1.2.31.9.3"></a><h4>Launching an application</h4>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="n">GdkAppLaunchContext</span> <span class="o">*</span><span class="n">context</span><span class="p">;</span>

<span class="n">context</span> <span class="o">=</span> <span class="n">gdk_display_get_app_launch_context</span> <span class="p">(</span><span class="n">display</span><span class="p">);</span>

<span class="n">gdk_app_launch_context_set_screen</span> <span class="p">(</span><span class="n">screen</span><span class="p">);</span>
<span class="n">gdk_app_launch_context_set_timestamp</span> <span class="p">(</span><span class="n">event</span><span class="o">-&gt;</span><span class="n">time</span><span class="p">);</span>

<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">g_app_info_launch_default_for_uri</span> <span class="p">(</span><span class="s">&quot;http://www.gtk.org&quot;</span><span class="p">,</span> <span class="n">context</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">error</span><span class="p">))</span>
  <span class="n">g_warning</span> <span class="p">(</span><span class="s">&quot;Launching failed: %s</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span> <span class="n">error</span><span class="o">-&gt;</span><span class="n">message</span><span class="p">);</span>

<span class="n">g_object_unref</span> <span class="p">(</span><span class="n">context</span><span class="p">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
</div>
</div>
<div class="refsect1">
<a name="gdk3-Application-launching.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="gdk-app-launch-context-new"></a><h3>gdk_app_launch_context_new ()</h3>
<pre class="programlisting"><a class="link" href="gdk3-Application-launching.html#GdkAppLaunchContext"><span class="returnvalue">GdkAppLaunchContext</span></a> *
gdk_app_launch_context_new (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<div class="warning">
<p><code class="literal">gdk_app_launch_context_new</code> has been deprecated since version 3.0 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="GdkDisplay.html#gdk-display-get-app-launch-context" title="gdk_display_get_app_launch_context ()"><code class="function">gdk_display_get_app_launch_context()</code></a> instead</p>
</div>
<p>Creates a new <a class="link" href="gdk3-Application-launching.html#GdkAppLaunchContext"><span class="type">GdkAppLaunchContext</span></a>.</p>
<div class="refsect3">
<a name="gdk-app-launch-context-new.returns"></a><h4>Returns</h4>
<p> a new <a class="link" href="gdk3-Application-launching.html#GdkAppLaunchContext"><span class="type">GdkAppLaunchContext</span></a></p>
</div>
<p class="since">Since: 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-app-launch-context-set-display"></a><h3>gdk_app_launch_context_set_display ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gdk_app_launch_context_set_display (<em class="parameter"><code><a class="link" href="gdk3-Application-launching.html#GdkAppLaunchContext"><span class="type">GdkAppLaunchContext</span></a> *context</code></em>,
                                    <em class="parameter"><code><a class="link" href="GdkDisplay.html" title="GdkDisplay"><span class="type">GdkDisplay</span></a> *display</code></em>);</pre>
<div class="warning">
<p><code class="literal">gdk_app_launch_context_set_display</code> has been deprecated since version 3.0 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="GdkDisplay.html#gdk-display-get-app-launch-context" title="gdk_display_get_app_launch_context ()"><code class="function">gdk_display_get_app_launch_context()</code></a> instead</p>
</div>
<p>Sets the display on which applications will be launched when
using this context. See also <a class="link" href="gdk3-Application-launching.html#gdk-app-launch-context-set-screen" title="gdk_app_launch_context_set_screen ()"><code class="function">gdk_app_launch_context_set_screen()</code></a>.</p>
<div class="refsect3">
<a name="gdk-app-launch-context-set-display.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>context</p></td>
<td class="parameter_description"><p>a <a class="link" href="gdk3-Application-launching.html#GdkAppLaunchContext"><span class="type">GdkAppLaunchContext</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>display</p></td>
<td class="parameter_description"><p>a <a class="link" href="GdkDisplay.html" title="GdkDisplay"><span class="type">GdkDisplay</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-app-launch-context-set-screen"></a><h3>gdk_app_launch_context_set_screen ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gdk_app_launch_context_set_screen (<em class="parameter"><code><a class="link" href="gdk3-Application-launching.html#GdkAppLaunchContext"><span class="type">GdkAppLaunchContext</span></a> *context</code></em>,
                                   <em class="parameter"><code><a class="link" href="GdkScreen.html" title="GdkScreen"><span class="type">GdkScreen</span></a> *screen</code></em>);</pre>
<p>Sets the screen on which applications will be launched when
using this context. See also <a class="link" href="gdk3-Application-launching.html#gdk-app-launch-context-set-display" title="gdk_app_launch_context_set_display ()"><code class="function">gdk_app_launch_context_set_display()</code></a>.</p>
<p>If both <em class="parameter"><code>screen</code></em>
 and <em class="parameter"><code>display</code></em>
 are set, the <em class="parameter"><code>screen</code></em>
 takes priority.
If neither <em class="parameter"><code>screen</code></em>
 or <em class="parameter"><code>display</code></em>
 are set, the default screen and
display are used.</p>
<div class="refsect3">
<a name="gdk-app-launch-context-set-screen.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>context</p></td>
<td class="parameter_description"><p>a <a class="link" href="gdk3-Application-launching.html#GdkAppLaunchContext"><span class="type">GdkAppLaunchContext</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>screen</p></td>
<td class="parameter_description"><p>a <a class="link" href="GdkScreen.html" title="GdkScreen"><span class="type">GdkScreen</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-app-launch-context-set-desktop"></a><h3>gdk_app_launch_context_set_desktop ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gdk_app_launch_context_set_desktop (<em class="parameter"><code><a class="link" href="gdk3-Application-launching.html#GdkAppLaunchContext"><span class="type">GdkAppLaunchContext</span></a> *context</code></em>,
                                    <em class="parameter"><code><span class="type">gint</span> desktop</code></em>);</pre>
<p>Sets the workspace on which applications will be launched when
using this context when running under a window manager that
supports multiple workspaces, as described in the
<a class="ulink" href="http://www.freedesktop.org/Standards/wm-spec" target="_top">Extended Window Manager Hints</a>.</p>
<p>When the workspace is not specified or <em class="parameter"><code>desktop</code></em>
 is set to -1,
it is up to the window manager to pick one, typically it will
be the current workspace.</p>
<div class="refsect3">
<a name="gdk-app-launch-context-set-desktop.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>context</p></td>
<td class="parameter_description"><p>a <a class="link" href="gdk3-Application-launching.html#GdkAppLaunchContext"><span class="type">GdkAppLaunchContext</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>desktop</p></td>
<td class="parameter_description"><p>the number of a workspace, or -1</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-app-launch-context-set-timestamp"></a><h3>gdk_app_launch_context_set_timestamp ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gdk_app_launch_context_set_timestamp (<em class="parameter"><code><a class="link" href="gdk3-Application-launching.html#GdkAppLaunchContext"><span class="type">GdkAppLaunchContext</span></a> *context</code></em>,
                                      <em class="parameter"><code><span class="type">guint32</span> timestamp</code></em>);</pre>
<p>Sets the timestamp of <em class="parameter"><code>context</code></em>
. The timestamp should ideally
be taken from the event that triggered the launch.</p>
<p>Window managers can use this information to avoid moving the
focus to the newly launched application when the user is busy
typing in another window. This is also known as 'focus stealing
prevention'.</p>
<div class="refsect3">
<a name="gdk-app-launch-context-set-timestamp.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>context</p></td>
<td class="parameter_description"><p>a <a class="link" href="gdk3-Application-launching.html#GdkAppLaunchContext"><span class="type">GdkAppLaunchContext</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>timestamp</p></td>
<td class="parameter_description"><p>a timestamp</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-app-launch-context-set-icon"></a><h3>gdk_app_launch_context_set_icon ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gdk_app_launch_context_set_icon (<em class="parameter"><code><a class="link" href="gdk3-Application-launching.html#GdkAppLaunchContext"><span class="type">GdkAppLaunchContext</span></a> *context</code></em>,
                                 <em class="parameter"><code><span class="type">GIcon</span> *icon</code></em>);</pre>
<p>Sets the icon for applications that are launched with this
context.</p>
<p>Window Managers can use this information when displaying startup
notification.</p>
<p>See also <a class="link" href="gdk3-Application-launching.html#gdk-app-launch-context-set-icon-name" title="gdk_app_launch_context_set_icon_name ()"><code class="function">gdk_app_launch_context_set_icon_name()</code></a>.</p>
<div class="refsect3">
<a name="gdk-app-launch-context-set-icon.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>context</p></td>
<td class="parameter_description"><p>a <a class="link" href="gdk3-Application-launching.html#GdkAppLaunchContext"><span class="type">GdkAppLaunchContext</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>icon</p></td>
<td class="parameter_description"><p>a <span class="type">GIcon</span>, or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-app-launch-context-set-icon-name"></a><h3>gdk_app_launch_context_set_icon_name ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gdk_app_launch_context_set_icon_name (<em class="parameter"><code><a class="link" href="gdk3-Application-launching.html#GdkAppLaunchContext"><span class="type">GdkAppLaunchContext</span></a> *context</code></em>,
                                      <em class="parameter"><code>const <span class="type">char</span> *icon_name</code></em>);</pre>
<p>Sets the icon for applications that are launched with this context.
The <em class="parameter"><code>icon_name</code></em>
 will be interpreted in the same way as the Icon field
in desktop files. See also <a class="link" href="gdk3-Application-launching.html#gdk-app-launch-context-set-icon" title="gdk_app_launch_context_set_icon ()"><code class="function">gdk_app_launch_context_set_icon()</code></a>.</p>
<p>If both <em class="parameter"><code>icon</code></em>
 and <em class="parameter"><code>icon_name</code></em>
 are set, the <em class="parameter"><code>icon_name</code></em>
 takes priority.
If neither <em class="parameter"><code>icon</code></em>
 or <em class="parameter"><code>icon_name</code></em>
 is set, the icon is taken from either
the file that is passed to launched application or from the <span class="type">GAppInfo</span>
for the launched application itself.</p>
<div class="refsect3">
<a name="gdk-app-launch-context-set-icon-name.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>context</p></td>
<td class="parameter_description"><p>a <a class="link" href="gdk3-Application-launching.html#GdkAppLaunchContext"><span class="type">GdkAppLaunchContext</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>icon_name</p></td>
<td class="parameter_description"><p>an icon name, or <code class="literal">NULL</code>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: 2.14</p>
</div>
</div>
<div class="refsect1">
<a name="gdk3-Application-launching.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GdkAppLaunchContext-struct"></a><h3>GdkAppLaunchContext</h3>
<pre class="programlisting">typedef struct _GdkAppLaunchContext GdkAppLaunchContext;</pre>
</div>
</div>
<div class="refsect1">
<a name="gdk3-Application-launching.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="GdkAppLaunchContext--display"></a><h3>The <code class="literal">“display”</code> property</h3>
<pre class="programlisting">  “display”                  <a class="link" href="GdkDisplay.html" title="GdkDisplay"><span class="type">GdkDisplay</span></a> *</pre>
<p>Display.</p>
<p>Owner: GdkAppLaunchContext</p>
<p>Flags: Read / Write / Construct Only</p>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.1</div>
</body>
</html>